package com.eda;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TabHost;

public class OwnerActivity extends TabActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setTitle("Owner Tab Activity");
		TabHost tabHost = getTabHost();
		
		LayoutInflater.from(this).inflate(R.layout.activity_owner,
				tabHost.getTabContentView(), true);
		tabHost.addTab(tabHost.newTabSpec("查找货源").setIndicator("查找货源")
				.setContent(R.id.ownerFindLayout));
		tabHost.addTab(tabHost.newTabSpec("发布货源").setIndicator("发布货源")
				.setContent(R.id.ownerPubLayout));
		tabHost.addTab(tabHost.newTabSpec("我的车源").setIndicator("我的车源")
				.setContent(R.id.ownerMyTrucksLayout));
		
		Button ownerMyTruck = (Button)findViewById(R.id.ownerPubMytruck);
		ownerMyTruck.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
				Intent ownToMytruck = new Intent(OwnerActivity.this, MyTruckActivity.class);
				startActivity(ownToMytruck);
			}
		});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.owner, menu);
		return true;
	}
	

}
